home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / lockdoslist.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  70 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: lockdoslist.c,v 1.3 1996/08/13 13:52:48 digulla Exp $
  4.     $Log: lockdoslist.c,v $
  5.     Revision 1.3  1996/08/13 13:52:48  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.2  1996/08/01 17:40:54  digulla
  10.     Added standard header for all files
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <clib/exec_protos.h>
  16. #include "dos_intern.h"
  17.  
  18. /*****************************************************************************
  19.  
  20.     NAME */
  21.     #include <clib/dos_protos.h>
  22.  
  23.     __AROS_LH1(struct DosList *, LockDosList,
  24.  
  25. /*  SYNOPSIS */
  26.     __AROS_LHA(ULONG, flags, D1),
  27.  
  28. /*  LOCATION */
  29.     struct DosLibrary *, DOSBase, 109, Dos)
  30.  
  31. /*  FUNCTION
  32.     Waits until the desired dos lists are free then gets a lock on them.
  33.     A handle is returned that can be used for FindDosEntry().
  34.     Calls to this function nest, i.e. you must call UnLockDosList()
  35.     as often as you called LockDosList(). Always lock all lists
  36.     at once - do not try to get a lock on one of them then on another.
  37.  
  38.     INPUTS
  39.     flags - what lists to lock
  40.  
  41.     RESULT
  42.     Handle to the dos list. This is not a direct pointer
  43.     to the first list element but to a pseudo element instead.
  44.  
  45.     NOTES
  46.  
  47.     EXAMPLE
  48.  
  49.     BUGS
  50.  
  51.     SEE ALSO
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.     29-10-95    digulla automatically created from
  57.                 dos_lib.fd and clib/dos_protos.h
  58.  
  59. *****************************************************************************/
  60. {
  61.     __AROS_FUNC_INIT
  62.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  63.     if(flags&LDF_WRITE)
  64.     ObtainSemaphore(&DOSBase->dl_DosListLock);
  65.     else
  66.     ObtainSemaphoreShared(&DOSBase->dl_DosListLock);
  67.     return (struct DosList *)&DOSBase->dl_DevInfo;
  68.     __AROS_FUNC_EXIT
  69. } /* LockDosList */
  70.